<%

Dim LI_ID			
Dim LI_Type			
Dim LI_Number		
Dim LI_NO			
Dim LI_Open_Date	

Dim Action
Dim Info_ID

Dim Lott_Num1
Dim Lott_Num2
Dim Lott_Num3
Dim Lott_Num4
Dim Lott_Num5
Dim Lott_Num6
Dim Lott_Num7

Sub Get_Lott_Info_Data()

	LI_Type = reform("LI_Type")
	Lott_Num1 = reform("Lott_Num1")
	Lott_Num2 = reform("Lott_Num2")
	Lott_Num3 = reform("Lott_Num3")
	Lott_Num4 = reform("Lott_Num4")
	Lott_Num5 = reform("Lott_Num5")
	Lott_Num6 = reform("Lott_Num6")
	Lott_Num7 = reform("Lott_Num7")
	LI_Number = Lott_Num1&"|"&Lott_Num2&"|"&Lott_Num3&"|"&Lott_Num4&"|"&Lott_Num5&"|"&Lott_Num6&"|"&Lott_Num7
	LI_NO	= reform("LI_NO")	
	LI_Open_Date	= reform("LI_Open_Date")	
	
End Sub 
Sub Lott_Info_Action()
	Info_ID = Get_ID("Info_ID")
	If Info_ID=0 Then 
		Call Lott_Info_Add()
	Else
		Call Lott_Info_Edit()
	End If 
End Sub 
Sub Lott_Info_Add()	
	

	Call Get_Lott_Info_Data()

	sql = "INSERT INTO Lott_Info( " &_
		"LI_Type"&_
		",LI_Number"&_
		",LI_NO"&_
		",LI_Open_Date"&_		


		") VALUES( " &_
		" '"&LI_Type&"'"&_

		",'"&LI_Number&"'"&_
		",'"&LI_NO&"'"&_
		",'"&LI_Open_Date&"'"&_
		")"


    conn.execute(sql)


	'Session("IT_ID") = IT_ID

	AlertBox "信息增加成功！","Lott_Info_Query.asp"


End Sub

Sub Lott_Info_Edit()	


	Call Get_Lott_Info_Data()
	Info_ID = Reform("Info_ID")
	Call Check_IsNumeric(Info_ID)

	sql = "UPDATE Lott_Info Set " &_
		  " LI_Type ='"&LI_Type&"'"&_
		  ",LI_Number ='"&LI_Number&"'"&_		  
		  ",LI_NO ='"&LI_NO&"'"&_
		  ",LI_Open_Date ='"&LI_Open_Date&"'"&_

		  " WHERE LI_ID = "&Info_ID

    conn.execute(sql)

	AlertBox "信息修改成功！","Lott_Info_Query.asp"

End Sub

Sub Lott_Info_Del()

	Info_ID = Reform("OP_ID")

	sql = "DELETE FROM  Lott_Info WHERE LI_ID IN ( "&Info_ID &")"

    conn.execute(sql)

	AlertBox "信息删除成功！","Lott_Info_Query.asp"
	
End Sub

Sub Get_Lott_Info(ID)

	Info_ID = Get_ID(ID)
	If Info_ID=0 Then 
		Action = "增加"
		Exit Sub 
	End If 

	Sql = "SELECT * FROM Lott_Info WHERE LI_ID="&Info_ID


	Set rs = conn.execute(sql)

	If Not rs.eof Then
		LI_Type			= rs("LI_Type") 
		LI_Number       = rs("LI_Number")
		LI_NO			= rs("LI_NO")
		LI_Open_Date	= rs("LI_Open_Date")
		LI_Number_Array = Split(LI_Number,"|")			   
		Lott_Num1 = LI_Number_Array(0)
		Lott_Num2 = LI_Number_Array(1)
		Lott_Num3 = LI_Number_Array(2)
		Lott_Num4 = LI_Number_Array(3)
		Lott_Num5 = LI_Number_Array(4)
		Lott_Num6 = LI_Number_Array(5)
		Lott_Num7 = LI_Number_Array(6)

	End If

	Action="修改"
End Sub 
Function Get_ID(Info_ID)
	If Request.ServerVariables ("Request_Method")="POST" Then
		ID = reform(Info_ID)
	Else
		ID = requery(Info_ID)
	End If 
	If IsNumeric(ID)=False Then 
		Get_ID = 0
	Else
		Get_ID = ID
	End If 
End Function 
%>


